/* $RCSFile: HttpHelper.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.Core/Helpers/HttpHelper.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:28  christian.surieux
 *   Added Log to All cs files
 */

using System; 
using System.IO; 
using System.Net; 

namespace AddonNice.Helpers 
{ 

	/// <summary> 
	/// HttpHelper
	/// </summary> 
	public class HttpHelper 
	{ 
		public Stream GetHttpStream(string pUrl, int pTimeout)
		{ 
			// handle on the remote resource 
			HttpWebRequest wr = (HttpWebRequest) WebRequest.Create(pUrl); 

			if(AddonNice.Configuration.PortalSettings.GetProxy() != null) 
				wr.Proxy = AddonNice.Configuration.PortalSettings.GetProxy(); 
			// set the HTTP properties 
			wr.Timeout = pTimeout * 1000; // milliseconds to seconds 
			// Read the response 
			WebResponse resp = wr.GetResponse(); 
			// Stream read the response 
			return(resp.GetResponseStream()); 
		} 
	} 
}